﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DutyList.aspx.cs" Inherits="Web.DutyList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <script src="Content/scripts/plugIn/Pagination/core.js" type="text/javascript"></script>
    <script src="Content/scripts/plugIn/Pagination/pagination.js" type="text/javascript"></script>
    <script src="Content/scripts/plugIn/CookieMethods.js"></script>
    <script>
        //取get参数
        function getArg() {
            var url = unescape(window.location.href);
            var allArgs = url.split("?")[1];
            if (allArgs != null) {
                var args = allArgs.split("&");
                for (var i = 0; i < args.length; i++) {
                    var arg = args[i].split("=");
                    eval('this.' + arg[0] + '="' + arg[1] + '";');
                } 
            }
        }

        DWZ.init("Content/scripts/plugIn/Pagination/pagination.xml");
        $(function () {
            var urlArg = new getArg();
            if (urlArg.numPerPage != undefined) {
                $("#numPerPage").val(urlArg.numPerPage);
            }
            setTimeout(paginationRender, 600);
            //仅 杨明俊314 可编辑 值班维护
            if (Cookies.get("empId") == 314) { $(".isDisplay").show(); } else {$(".isDisplay").hide(); }
        });
        function paginationRender() {
            $("div.pagination").each(function () {
                var $this = $(this);
                $this.pagination({
                    totalCount: $this.attr("totalCount"),
                    numPerPage: $this.attr("numPerPage"),
                    pageNumShown: $this.attr("pageNumShown"),
                    currentPage: $this.attr("currentPage")
                });
            });
        }
        function PageBreak(args) {
            //alert(args["pageNum"] || args["numPerPage"]);
            if (args["pageNum"] == undefined) {args["pageNum"] = $("li.selected a").text();}
            if (args["numPerPage"] == undefined) { args["numPerPage"] =$("#numPerPage").val(); }
            location.href = "DutyList.aspx?pageNum=" + args["pageNum"] + "&numPerPage=" + args["numPerPage"];
        }
        function fnDel(date) {
            $.ajax({
                type: 'POST',
                url: '/Duty.mvc/Del',
                data: 'date=' + date,
                cache: false,
                error: function (response) {
                    alert("删除失败\nHttp status: " + response.status + "\n" + response.statusText);
                },
                success: function (response) {
                    if (response == "Succ") { alert('删除成功!');
                        location.reload(); }
                    else { alert('删除失败!'); }
                }
            });
        }
    </script>
    <link href="Content/scripts/plugIn/Pagination/style.css" rel="stylesheet" type="text/css" />
    <link href="Content/scripts/plugIn/Pagination/core.css" rel="stylesheet" type="text/css" />
    <style>
    .header{font-size:18px;margin:24px auto 6px auto;}
    a.buttonActive,a.button{margin:auto 6px;}
    </style>
</head>
<body>
<div class="header">值班安排列表</div>
    <a class="buttonActive isDisplay" href="javascript:location.href='DutyEdit.aspx';"><span>新增</span></a>
    <a class="button" href="javascript:window.close();"><span>关闭</span></a>
    <form runat="server">
<asp:Repeater ID="rptList" EnableViewState="False" Runat="server" onitemdatabound="rptList_ItemDataBound">
	<HeaderTemplate>
		<table id="tbList" class="list">
			<thead>
				<tr><th>值班日期</th><th>轮值高管</th><th>值班经理</th><th>业务部</th><th>行政中心</th><th>结算部</th><th>物流中心</th><th>财务中心</th><th>产品部</th><th>会议管理部</th><th class="isDisplay">操作</th></tr>
			</thead>
		<tbody>
	</HeaderTemplate>
	<ItemTemplate>
		<tr>
        <td><%# Convert.ToDateTime(Container.DataItem).ToString("yyyy-MM-dd")%></td>
        <td>
            <asp:Repeater ID="rptGaoGuan" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt")+")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater>
        </td>
        <td>
            <asp:Repeater ID="rptJingLi" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptYeWu" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptXingZheng" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptJieSuan" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptWuLiu" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptCaiWu" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptChanPing" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater></td>
        <td>
            <asp:Repeater ID="rptHuiYi" EnableViewState="False" Runat="server">
				<HeaderTemplate>
					<table>
				</HeaderTemplate>
				<ItemTemplate>
					<tr>
						<td><%# DataBinder.Eval(Container.DataItem, "Name") + "(" + DataBinder.Eval(Container.DataItem, "TelExt") + ")"%></td>
					</tr>
				</ItemTemplate>
				<FooterTemplate>
					</table>
				</FooterTemplate>
			</asp:Repeater>
        </td>
        <td class="isDisplay"><a href="#" onclick="return fnDel('<%# Convert.ToDateTime(Container.DataItem).ToString("yyyy-MM-dd")%>');">删除</a></td>
        </tr>
	</ItemTemplate>
	<FooterTemplate>
		</tbody> </table>
	</FooterTemplate>
</asp:Repeater>
    </form>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select id="numPerPage" name="numPerPage" onchange="javascript:PageBreak({numPerPage:this.value});">
                <option value="5">5</option>
                <option value="10">10</option>
                <option value="15">15</option>
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="50">50</option>
                <option value="100">100</option>
            </select>
            <span>条，共 <%= Model.TotalCount%> 条</span>
        </div>
        <div class="pagination" totalcount="<%= Model.TotalCount%>" numperpage="<%= Model.NumPerPage%>" pagenumshown="<%= Model.PageNumShown%>" currentpage="<%= Model.CurrentPage%>"></div>
    </div>
</body>
</html>